package com.hdjk.view.activity.personalcenter;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.hdjk.view.R;
import com.hdjk.view.util.ToastUtils;
import com.hdjk.view.util.UserTokenUtil;
import com.lst.projectlib.base.BaseActivity;

/**
 * 密码管理页
 * Created by Administrator on 2017/11/4.
 */

public class PwdManagerActivity extends BaseActivity implements View.OnClickListener {

    // Content View Elements
    private com.lst.projectlib.component.CustomView.TopTitleBar ttb_title_bar;
    private RelativeLayout rel_login_pwd;
    private RelativeLayout rel_tran_pwd;
    private RelativeLayout rel_forget;
    // End Of Content View Elements

    private void bindViews() {

        ttb_title_bar = (com.lst.projectlib.component.CustomView.TopTitleBar) findViewById(R.id.ttb_title_bar);
        rel_login_pwd = (RelativeLayout) findViewById(R.id.rel_login_pwd);
        rel_tran_pwd = (RelativeLayout) findViewById(R.id.rel_tran_pwd);
        rel_forget = (RelativeLayout) findViewById(R.id.rel_forget);
    }


    @Override
    protected void initView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_pwd_manager);
        bindViews();
        ttb_title_bar.findViewById(R.id.tvNavBack).setOnClickListener(this);
        rel_login_pwd.setOnClickListener(this);
        rel_tran_pwd.setOnClickListener(this);
        rel_forget.setOnClickListener(this);
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.tvNavBack:
                back();
                break;
            case R.id.rel_login_pwd:
                intent=new Intent(PwdManagerActivity.this,AlertPwdActivity.class);
                intent.putExtra("pwdType",AlertPwdActivity.PWD_TYPE_LOGIN);
                startActivity(intent);
                break;
            case R.id.rel_tran_pwd:
                if (!UserTokenUtil.isOpenAccount(this)){
                    ToastUtils.showShortToast(this,"您未开户，请先开户");
                    return;
                }
                intent=new Intent(PwdManagerActivity.this,AlertPwdActivity.class);
                intent.putExtra("pwdType",AlertPwdActivity.PWD_TYPE_TRAN);
                startActivity(intent);
                break;
            case R.id.rel_forget:
                if (!UserTokenUtil.isOpenAccount(this)){
                    ToastUtils.showShortToast(this,"您未开户，请先开户");
                    return;
                }
                intent=new Intent(PwdManagerActivity.this,ForgetPwdActivity.class);
                intent.putExtra("pwdType",AlertPwdActivity.PWD_TYPE_TRAN);
                startActivity(intent);
                break;
        }
    }
}
